<html ng-app="app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../build/common/ngEdit.css" rel="stylesheet">
<script type="text/javascript" src="../../build/common/ngEdit.js"></script>
<script type="text/javascript" src="../../assets/js/platform/sys/sysDataSource/sysDataSourceEditController.js"></script>
<script type="text/javascript">
	
</script>
</head>
<body ng-controller="ctrl" ng-init="init()">
	<div class="ibox-title">
		<a class="btn btn-primary fa-save" href="javascript:void(0)" ng-model="data" ab-save="/sys/sysDataSource/save">保存</a>
		<a href="javaScript:void(0)" class="btn btn-primary fa-reply" onclick="javascript:$.Dialog.close(window);">取消</a>
	</div>
	<form name="form" ab-load="/sys/sysDataSource/getObject?id={id}" ng-model="data">
		<table class="form-table">
			<tr>
				<th>名字</th>
				<td>
					<input ng-model="data.name" ab-validate="{required:true}" class="form-control" />
				</td>
			</tr>
			<tr>
				<th>别名</th>
				<td>
					<input ng-model="data.key" ab-validate="{required:true,varirule:true}" class="form-control" ab-pinyin="data.name" />
				</td>
			</tr>
			<tr>
				<th>描述</th>
				<td>
					<textarea ng-model="data.desc" class="form-control"></textarea>
				</td>
			</tr>
			<tr>
				<th>数据库类型:</th>
				<td>
					<select class="form-control" ng-model="data.dbType" ng-change="dbTypeChange()" ng-options="v.key as v.desc for (k,v) in DbType">
					</select>
				</td>
			</tr>
			<tr>
				<th>数据源模板</th>
				<td>
					<select class="form-control" ng-model="data.classPath" ng-change="sysDataSourceDefChange()" ng-options="m.classPath as m.name for m in AllSysDataSourceDefs">
					</select>
				</td>
			</tr>
		</table>
		<table class="form-table" ng-show="data.attributes">
			<tr>
				<th>描述</th>
				<th>字段名</th>
				<th>参数类型</th>
				<th>值</th>
			</tr>
			<tr ng-repeat="item in data.attributes">
				<td>{{item.comment}}</td>
				<td>{{item.name}}</td>
				<td>{{item.type}}</td>
				<td ng-if="item.required">
					<input ng-model="item.value" ab-validate="{required:true}" class="form-control" />
				</td>
				<td ng-if="!item.required">
					<input ng-model="item.value" class="form-control" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>